import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import axios from 'axios'
import './plugins/element.js'
// 导入全局配置css 以及重置的elUI样式
import './assets/css/global.css'
import './assets/css/reset.css'
// 导入路由权限配置
import '@/utils/permission'
// 导入echarts 
import * as echarts from 'echarts'

import axios from 'axios'
import nprogress from 'nprogress'
const service = axios.create({
  baseURL: "https://120.78.137.246:8888/api/private/v1/",
  timeout: 5000
})
service.interceptors.request.use(config => {
  nprogress.start();
  config.headers.Authorization = sessionStorage.getItem('token');
  // console.log(config); 请求配置文件
  return config
})
// 在请求返回后 关闭进度条
service.interceptors.response.use(config => {
  nprogress.done();
  return config
})

Vue.prototype.$http = service

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App),
  beforeCreate() {
    //挂载全局事件总线
    Vue.prototype.$bus = this
    //挂载echarts
    Vue.prototype.$echarts = echarts
  }
}).$mount('#app')
